<?php
declare(strict_types=1);

namespace LowCode\UI;

use LowCode\Support\JsExp;

/**
 * @method static static make(string|JsExp $text = null, string|JsExp $tag = "");
 */
class Content extends Node
{
    public function __construct(string|JsExp $text = null, string|JsExp $tag = "")
    {
        parent::__construct("WContent");
        $text && $this->text($text);
        $tag && $this->tag($tag);
    }

    /**
     * @param string|JsExp $text
     * @return $this
     */
    public function text(string|JsExp $text): static
    {
        return $this->prop("text",$text);
    }

    /**
     * @param string|JsExp $tag
     * @return $this
     */
    public function tag(string|JsExp $tag): static
    {
        return $this->prop("tag",$tag);
    }

    /**
     * @param bool|JsExp $bool
     * @param string|JsExp $tag
     * @return $this
     */
    public function isHtml(bool|JsExp $bool = true, string|JsExp  $tag = "div"): static
    {
        return $this->tag($tag)->prop("isHtml",$bool);
    }
}
